import 'package:mobx/mobx.dart';
import 'package:injectable/injectable.dart';
import 'increment_counter_usecase.dart';

part 'counter_store.g.dart';

@injectable
// ignore: library_private_types_in_public_api
class CounterStore = _CounterStore with _$CounterStore;

abstract class _CounterStore with Store {
  final IncrementCounterUseCase _incrementCounterUseCase;

  _CounterStore(this._incrementCounterUseCase) {
    _incrementCounterUseCase.setCounterStore(this as CounterStore);
  }

  @observable
  int counter = 0;

  @action
  void increment() {
    // var logger = Logger();
    // logger.d('Incrementing counter');
    _incrementCounterUseCase.execute();
  }
}